
$(document).ready(function(){
   $('#startLuyin').click(function(){
    createRecorder();
    recOpen();
   })
   $('#stopLuyin').click(function(){
    recStop("1");
   })
   $('#bofang').click(function(){
    recPlay();
   })
 });
var Config = {
	//正确的key
	appKey: "15519432860000a3",
	secretKey: "533890198684bc5507a46b034b7549da",
	//测试
	// appKey: "15519432860000a5",
	// secretKey: "533890198684bc5507a46b034b7549dd",
};
 function createRecorder() { //启用麦克风服务
	lastRecordId = "";
	recorder = null;
	recorder = new _17kouyu.IRecorder({
		id: "iRecorder", //这里为HTML节点对应的id
		mode: 2,
		debug: true,
		encode: "raw", //关掉音频压缩
		appKey: Config.appKey,
		secretKey: Config.secretKey,
		//wmode: "transparent",
		onFlashLoad: function (code, message) {
			console.log("录音机加载成功");
		},
		onConnectorStatusChange: function (code, message) {
			if (code == "50100") {
				console.log("连接录音服务器成功");
			}
		},
		onMicStatusChange: function (code, message) {//正在录音才能触发
			if (code == "50001") {
				console.log("可以访问麦克风");
			
			}
			if (code == "50002") {
				console.log("不可以访问麦克风");
				
			}
			
		},
		onError: function (code, message) {
			console.log(code, message + '错误');
			
		}
	});
}
